import {createRouter, createWebHistory} from 'vue-router'

const router = createRouter({
    history: createWebHistory(),
    routes: [
        {
            path: '/home',
            component: () => import('@/pages/home/Home.vue'),
            meta:{
                title:'首页'
            }
        },
        {
            path: '/hospital',
            component: () => import('@/pages/hospital/Hospital.vue'),
            children: [
                {
                    path: 'register',
                    component: () => import('@/pages/hospital/reg/Register.vue'),
                    meta: {
                        title: '预约挂号'
                    }
                },
                {
                    path: 'detail',
                    component: () => import('@/pages/hospital/HospDetail.vue'),
                    meta:{
                        title:'医院详情'
                    }
                },
                {
                    path: 'notice',
                    component: () => import('@/pages/hospital/Notice.vue'),
                    meta:{
                        title:'预约通知'
                    }
                },
                {
                    path: 'close',
                    component: () => import('@/pages/hospital/Close.vue'),
                    meta:{
                        title:'停诊信息'
                    }
                },
                {
                    path: 'search',
                    component: () => import('@/pages/hospital/HospSearch.vue'),
                    meta:{
                        title:'查询'
                    }
                },
                {
                    path: 'reg1',
                    component: () => import('@/pages/hospital/reg/RegisterStep1.vue'),
                    meta:{
                        title:'预约第一步'
                    }
                },
                {
                    path: 'reg2',
                    component: () => import('@/pages/hospital/reg/RegisterStep2.vue'),
                    meta:{
                        title:'预约第二步'
                    }
                }
            ]
        },
        {
            path: '/wxlogin',
            component: () => import('@/pages/WechatLogin.vue')
        },
        {
            path: '/',
            redirect: '/home'
        },
        {
            path: '/user',
            component: () => import('@/pages/user/User.vue'),
            children: [
                {
                    path: 'certification',
                    component: () => import('@/pages/user/Certification.vue'),
                    meta:{
                        title:'实名认证'
                    }
                },
                {
                    path: 'order',
                    component: () => import('@/pages/user/orders/Order.vue'),
                    meta:{
                        title:'挂号订单'
                    }
                },
                {
                    path: 'patient',
                    component: () => import('@/pages/user/Patient.vue'),
                    meta:{
                        title:'就诊人管理'
                    }
                },
                {
                    path: 'profile',
                    component: () => import('@/pages/user/Profile.vue'),
                    meta:{
                        title:'账号信息'
                    }
                },
                {
                    path: 'feedback',
                    component: () => import('@/pages/user/Feedback.vue'),
                    meta:{
                        title:'信息反馈'
                    }
                }
            ]
        }
    ],
    scrollBehavior() {
        return {
            left: 0,
            right: 0,
        }
    }
})

export default router